package com.lianxueda.drawing.mapper;

import com.lianxueda.drawing.domain.pojo.ClassCourses;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
* @author 29264
* @description 针对表【class_courses】的数据库操作Mapper
* @createDate 2024-08-27 08:33:47
* @Entity com.lianxueda.drawing.domain.pojo.ClassCourses
*/
@Mapper
public interface ClassCoursesMapper extends BaseMapper<ClassCourses> {


    @Select("SELECT course_id FROM class_courses WHERE class_id = #{classId}")
    List<Integer> selectCourseIdsByClassId(@Param("classId") Integer classId);

    @Select("SELECT course_id FROM class_courses WHERE class_id = #{classId}")
    List<Integer> getCoursesIdByClassId(@Param("classId") Integer classId);



    List<ClassCourses> selectByCourseIds(@Param("list") List<Integer> courseIds);


    int updateById (ClassCourses classCourses);

    @Insert("INSERT INTO class_courses(class_id,course_id) VALUES(#{classId},#{courseId})")
    void addCourseForClass(@Param("classId") Integer classId,@Param("courseId")  Integer courseId);


    void updataClassIdByCourseId(@Param("classId") Integer classId,@Param("courseId")  Integer courseId);
}




